package zy3;

import java.util.Scanner;

/**
 * 企鹅类
 */
public class Penguin {
    private int health;//健康值
    private int love = 10;//亲密度

    public Penguin() {

    }

    public Penguin(int health, int love) {
        this.health = health;
        this.love = love;
    }

    public int getHealth() {
        return health;
    }

    public void setHealth(int health) {
        this.health = health;
    }

    public int getLove() {
        return love;
    }

    public void setLove(int love) {
        this.love = love;
    }

    //宠物商店
    String name;
    int num;
    String sex;
    public void petShop() {
        Scanner input = new Scanner(System.in);
        System.out.println("欢迎来到宠物店!");
        System.out.println("请输入要领养的宠物:");
        name = input.nextLine();
        System.out.println("请选择要领养的宠物类型:(1、狗狗 2、企鹅)");
        num = input.nextInt();
        if (num == 1) {
            System.out.println("狗狗卖完了!");
        } else {
            System.out.println("请选择企鹅的性别:(1、Q仔 2、Q妹)");
            sex = input.next();
            if (sex.equals(1)){
                sex = "Q仔";
            }else {
                sex = "Q妹";
            }
            System.out.println("请输入企鹅的健康值(1~100之间):");
            this.health = input.nextInt();
            if (this.health >= 0 && this.health <= 100) {
                this.health = health;
            }else {
                this.health = 60;
            }
        }
        System.out.println("宠物的自白:");
        System.out.println("我的名字叫:"+name+",健康值是:"+this.health+",和主人的亲密度是:"+this.love+",我的性别是:"+sex);
    }

    public static void main(String[] args) {
        Penguin penguin = new Penguin();
        penguin.petShop();
    }
}
